<?php
/**********************************************************************//**\file
	Armory UI

	Description:  Provides a user-interface abstraction and localization layer
		to be used across various views.
*******************************************************************************/

	class armoryui
	{
		protected $race;
		protected $class;
		protected $talent;
		protected $gender;
		protected $profession;
		protected $rank;

		protected $base_url = null;

		public function __construct()
		{
			global $config;

			$this->base_url = $config['base_url'];

			require_once(dirname(__FILE__).'/../localization/'.$config['language'].'/lang.php');

			$this->race = $race;
			$this->class = $class;
			$this->talent = $talent;
			$this->gender = $gender;
			$this->profession = $profession;

			for($i = 0; $i < 10; $i++)
			{
				$this->rank[$i] = $config['rank'.$i];
			}
		}

		public function player_name($name)
		{
			return utf8_encode($name);
		}

		public function player_rank($rank)
		{
			return $this->rank[$rank];
		}

		public function player_race($race)
		{
			return $this->race[$race];
		}

		public function player_gender($gender)
		{
			return $this->gender[$gender];
		}

		public function player_race_img($race, $gender)
		{
			return '<img alt="'.$this->player_race($race).' '.$this->player_gender($gender).'" src="'.$this->base_url.'icons/race/'.$race.'-'.$gender.'.gif" />';
		}

		public function player_class($class)
		{
			return $this->class[$class];
		}

		public function player_class_img($class)
		{
			return '<img alt="'.$this->player_class($class).'" src="'.$this->base_url.'icons/class/'.$class.'.gif" />';
		}

		public function player_talents($class, $tree1, $tree2, $tree3)
		{
			$tt = ($tree1 + $tree2 + $tree3) * .65; # Hybrid threshold at <65% total talents invested in one tree.
			if($tree1 < $tt && $tree2 < $tt && $tree3 < $tt)
				return $this->talent[0];
			else
			{
				if($tree1 > $tree2 && $tree1 > $tree3)
					return($this->talent[$class][0]);
				elseif ($tree2 > $tree3)
					return($this->talent[$class][1]);
				else
					return($this->talent[$class][2]);
			}
		}

		public function player_talents_img($class, $tree1, $tree2, $tree3)
		{
			
		}

		public function player_profession($prof_key)
		{
			if(!is_null($prof_key))
			{
				return $this->profession[$prof_key];
			}
		}

		public function player_profession_skill($prof_skill)
		{

		}

		public function player_profession_img($prof_key)
		{
			if(!is_null($prof_key))
			{
				return '<img alt="'.$this->player_profession($prof_key).'" src="icons/prof/'.$prof_key.'.jpg" />';
			}
		}
	}
?>
